Control ow analysis: a compilation paradigm for functional language
نویسنده
چکیده
Revised version of "SAC 95" 31/08/95] Abstract Control ow analysis (cfa) is now well known but is not widely used in real compilers since optimizations that can be achieved via cfa are not so clear. This paper aims at showing that control ow analysis is very valuable in practice by presenting a fundamental optimization based on cfa: the closure representation algorithm, the essential optimizing phase of a-language compiler. Since na ve and regular scheme to represent functions as heap allocated structures is far too ineecient, the main eeort of modern functional languages compilers is devoted to minimize the amount of memory allocated for functions. In particular, compilers try to discover when a procedure can safely be handled without any allocation at all. Previously described methods to do so are ad hoc, depending on the language compiled, and not very precise. Using cfa, we present a general approach which produces better results. This reened closure analysis subsumes previously known ones and optimizes more than 80 % of closure on the average. We also present another analysis based on cfa which is useful for dynamically typed languages: the type investigation algorithm. Modifying Shivers' cfa, we realized a type inference algorithm that eliminates more than 60 % of dynamic type tests. These two optimizations are fully integrated into a real compiler, so that we can report reliable measures obtained for real world programs. Time gures show that analyses based on cfa can be very eecient: when the compiler uses the improved closure allocation scheme and the type investigation algorithm, the resulting executable programs run more than two time faster.
منابع مشابه
Abstract Compilation: A New Implementation Paradigm for Static Analysis
Compilation: a New Implementation Paradigm for Static Analysis Dominique Boucher and Marc Feeley D epartement d'informatique et de recherche op erationnelle (IRO) Universit e de Montr eal C.P. 6128, succ. centre-ville, Montr eal, Qu ebec, Canada H3C 3J7 E-mail: fboucherd,[email protected] Abstract. For large programs, static analysis can be one of the most time-consuming phases of the wh...
متن کاملPr Esent Ee R Esum E
Control ow analysis is important in optimizing compilers of functional languages It strives to approximate at compile time dynamic function call graphs of program evaluation The precision of the approximation drives the e ciency of optimizations applied in compilers Control ow analysis can be expressed by both e ect systems and abstract interpretation My thesis work extends and combines these t...
متن کاملCompilation as Metacomputation: Binding Time Separation in Modular Compilers (ex Tende D Abstract)
This paper presents a modular and extensible style of language speciication based on meta-computations. This style uses two monads to factor the static and dynamic parts of the speci-cation, thereby staging the speciication and achieving strong binding-time separation. Because metacomputations are deened in terms of monads, they can be constructed modularly and ex-tensibly using monad transform...
متن کاملThe GRIN Project: A Highly Optimising Back End for Lazy Functional Languages
Low level optimisations from conventional compiler technology often give very poor results when applied to code from lazy functional languages, mainly because of the completely diierent structure of the code, unknown control ow, etc. A novel approach to compiling laziness is needed. We describe a complete back end for lazy functional languages, which uses various interprocedural optimisations t...
متن کاملCompilation of Functional Languages Using Ow Graph Analysis
To implement lazy functional languages eeciently it is necessary for a compiler analyse many properties of the program. Analysis techniques proposed to support such implementations have a similar structure and each analysis is of suucient complexity that it requires a signiicant body of research to exploit to the full. We present ow graphs as a formal framework to support the diierent program a...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1995